/*!
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 *    Author: flareguner
 *    E-Mail: flareguner@gmail.com
 *    Years: 2010-2011
 */



/*!
  This class provide expressions exceptions.
  not to be confused with systemn exceptions
  */


#ifndef EXCEPTIONS_H
#define EXCEPTIONS_H

#include <QDialog>

class QPushButton;
class QGroupBox;
class QListWidget;
class QDialogButtonBox;
class QVBoxLayout;
class QHBoxLayout;
class QFrame;

class Exceptions : public QDialog
{
    Q_OBJECT
public:
    explicit Exceptions(QWidget *parent = 0);
    ~Exceptions();
public slots:
    /** !
    *	 Add exception @param seq without gui,
    *	 directly to log
    **/
    void add(const QString &seq);
    //! Case sensetive comparsion
    void setCaseSensetivity(bool b) {
	m_flag_cs = b;
    }


    /*! Return processed @param text with
     *special tags. Use it before translation
     */
    QString processSourceText(const QString &text);

    /*! Return processed @param text
     *(replace tagged seq's to normal seq's).
     * Use it after translation
     */
    QString processResultText(const QString &text);
private:
    //! Private data members
    QPushButton *addButton, *deleteButton, *clearButton;
    QListWidget *exceptionsList;
    QVBoxLayout *centralLayout, *mainLayout;
    QHBoxLayout *buttonsLayout;
    QGroupBox *centralGroupBox;
    QFrame *horizontalFrame;
    QDialogButtonBox *dialogButtons;

    static const QString
    // Thisi s splitter for splitting in file
    m_splitter;
    // This is prefix for translation request
//    m_prefix;


    QStringList m_exceptions_list;
    bool m_flag_changed, m_flag_cs;
    //! Private functions members

    //! Create user interface
    void createUi();

    //! Chane Events handler
    void changeEvent(QEvent *);
private slots:
    void acceptDialog();
    //! Update buttons state (Enable\disable him)
    void updateButtons();
    //! Slots for buttons
    void addSeq();
    void deleteSeq();
    void clearSeq();
    //! Load\save params
    void load();
    void save();
};

#endif // EXCEPTIONS_H
